package net.hn.hnms.biz.safety.location.repository;

import net.hn.hnms.biz.safety.location.domain.DutyLeadEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * Author: PanSX
 * Date: 2023/5/9 16:30
 */
@Repository
public interface DutyLeadEntityRepository extends JpaRepository<DutyLeadEntity,Long> {

    DutyLeadEntity findFirstByMineCodeOrderByDataTimeDesc(String mineCode);

    /**
     * 查询当天的第一条带值班
     * @return
     */
    @Query(value = "SELECT * FROM lead_duty  where data_time >= CURRENT_DATE ORDER BY data_time LIMIT 1",nativeQuery = true)
    DutyLeadEntity findOneDay();
}
